<?php
    /**
     * Created by PhpStorm.
     * User: wesley
     * Date: 2018/6/15
     * Time: 1:15
     */

    namespace app\admin\model;


    use think\Model;

    class Admin extends Model {

        public function checkLogin($username,$password)
        {
            $admin = $this->db('user',$username)->find();
            if ($admin){
                $user = $admin->toArray();
                $pass = md5($password);
                if ($pass ==$user['password']){
                    $res = ['status'=>1,'message'=>'登录成功'];
                } else {
                    $res = ['status'=>0,'message'=>'密码错误'];
                }
            }else {
                $res = ['status'=>0,'message'=>'用户名不存在！'];
            }
            return $res;
        }

    }